package org.hive.vmware.client.model;

import com.extjs.gxt.ui.client.data.BaseTreeModel;

public class VmVO extends BaseTreeModel {

	private static final long serialVersionUID = 1L;
	private VmGroupVO vmGroupVO;
	
	public void setName(String name) {
		set("name", name);
	}
	
	public String getGroupMember() {
		return get("groupMember");
	}
	
	public void setGroupMember(String groupMember) {
		set("groupMember", groupMember);
	}
	
	public String getName() {
		return get("name");
	}
	
	public String getDescription() {
		return get("description");
	}
	
	public String getHost() {
		return get("host");
	}
	public void setHost(String host) {
		set("host", host);
	}
	
	public String getCenterServer() {
		return get("centerServer");
	}
	
	public void setCenterServer(String dataCenterServer) {
		set("centerServer", dataCenterServer);
	}
	
	public void setDataCenter(String dataCenter) {
		set("dataCenter", dataCenter);
	}
	
	public String getDataCenter() {
		return get("dataCenter");
	}
	public void setDescription(String description) {
		set("description", description);
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof VmVO) {
			VmVO otherVm = (VmVO)obj;
			return this.getName().equals(otherVm.getName())
			 && this.getHost().equals(otherVm.getHost());
		} else {
			return false;
		}
	}

	public void setVmGroupVO(VmGroupVO vmGroupVO) {
		this.vmGroupVO = vmGroupVO;
		if (vmGroupVO != null) {
			setGroupMember(vmGroupVO.getName());
		}
	}

	public VmGroupVO getVmGroupVO() {
		return vmGroupVO;
	}
}
